package de.jkoslows.decisions.boundaries;

import java.util.Collection;

import de.jkoslows.decisions.control.Decision;
import de.jkoslows.decisions.control.Items;
import de.jkoslows.decisions.control.Parameters;
import de.jkoslows.decisions.control.Types;
import de.jkoslows.decisions.entity.ExpressionParameter;
import de.jkoslows.decisions.entity.Item;
import de.jkoslows.decisions.entity.Parameter;
import de.jkoslows.decisions.entity.Type;
import de.jkoslows.decisions.entity.Unit;

public class DecisionMaker {
	
	public Item createItem(long id ,String name, String description){
		return Items.create(name, description);
	}
	
	public Collection<Item> readItems(){
		return Items.getItems();
	}
	
	public Item updateItem(Item item){
		return Items.update(item);
	}
	
	public void deleteItem(Item item){
		Items.delete(item);
	}
	
	public Parameter createParameter(Type type, double value, Unit unit){
		return Parameters.getParameter(type.toString(), value, unit.toString());
	}
	
	
	public Type createType(String type ,Unit unit){
		return Types.getType(type, unit.toString());
	}
	
	public Collection<Type> getTypes(){
		return Types.getTypes();
	}
	
	public Unit createUnit(String unit){
		return Types.createUnit(unit);
	}
	
	public Collection<Unit> getUnits(){
		return Types.getUnits();
	}
	
	public Collection<Item> findItemsThatMeetParameters(Collection<Item> items, Collection<ExpressionParameter> paramters, boolean ignoreMissingParametersAtItems){
		Decision decision = new Decision(ignoreMissingParametersAtItems);
		decision.addItems(items);
		decision.addParameters(paramters);
		return decision.decide();
	}
	
	
	
	
	
	

}
